import math
WIDTH = 800
HEIGHT = 800
lenth = 50
Dy = 400
x,hy = 400,200
h = math.sqrt(lenth ** 2 - (lenth / 2) ** 2)
ly = hy + h
Bx = x - lenth / 2
Cx = x + lenth / 2
flag = False
def draw():
#    screen.clear()
#    global lenth,x,hy
#    h = math.sqrt(lenth ** 2 - (lenth / 2) ** 2)
#    ly = hy + h
#    Bx = x - lenth / 2
#    Cx = x + lenth / 2
#    screen.draw.line((Bx,ly),(Cx,ly),(200,0,0))
#    screen.draw.line((x,hy),(Bx,ly),(0,200,0))
#    screen.draw.line((x,hy),(Cx,ly),(0,0,200))
    pass
def update():
    screen.clear()
    global lenth,flag
    h = math.sqrt(lenth ** 2 - (lenth / 2) ** 2)
    print(h)
    ly = hy + h
    print(ly)
    Bx = x - lenth / 2
    print(Bx)
    Cx = x + lenth / 2
    print(Cx)
    if flag == True:
        lenth -= 1
        print(lenth)
        if lenth <= 50:
            flag = False
    if flag == False:
        lenth += 1
        print(lenth)
        if lenth >= 150:
            flag = True
    screen.draw.line((Bx,ly),(Cx,ly),(200,0,0))
    screen.draw.line((x,hy),(Bx,ly),(0,200,0))
    screen.draw.line((x,hy),(Cx,ly),(0,0,200))
    print(lenth)
